package day05.localDate;

import java.time.LocalDate;
import java.util.Calendar;
import java.util.Scanner;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/25
 * 7.输入任意一个年份，得到这年的2月份有几天？
 */
public class Test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个年份：");
        int year = sc.nextInt();
//       LocalDate localDate = LocalDate.of(year, 2, 1);
        LocalDate localDate = LocalDate.now();
        LocalDate date = localDate.withYear(year).withMonth(2);
        int days = date.lengthOfMonth();
        System.out.println(year + " 年的 2 月份有 " + days+ " 天");
        sc.close();
    }

}
